import 'dart:math';
import 'dart:ui';

import 'package:decimal/decimal.dart';
import 'package:flutter/material.dart';
import 'package:myflutter/math/model/variable.dart';


//仅仅是方便调试的函数模型，并没有考虑规范化
class MathFunction  extends ChangeNotifier{
  MathFunction () {
    // TODO: implement mathFunctions
  }
  List<Offset> getOffsets() {
    List<double> x = [];
    List<double> y = [];
    for (Decimal i = Decimal.parse("-10"); i < Decimal.parse("10"); i+=Decimal.parse("0.005")) {
      double index = i.toDouble();
      MathVariable mathVariableX = MathVariable("x");
      double X = mathVariableX.getValue(index);// x = x
      double Y = mathVariableX.power(-1).getValue(index); //y = 1/x

      x.add(X);
      y.add(Y);


    }
    return List.generate(x.length, (index) => Offset(x[index], y[index]));
  }
}